{extend name="common/index" /}
{block name="style"}
<link rel="stylesheet" href="__TEMPLATE__/mobile/index/css/index.css" type="text/css">
<link rel="stylesheet" href="__TEMPLATE__/mobile/index/css/member.css" type="text/css">
<script type="text/javascript" src="__TEMPLATE__/sysme/js/user_name.js"></script>
<style type="text/css">
	 input::-webkit-input-placeholder{
            color:#cccccc;
        }
        input::-moz-placeholder{   /* Mozilla Firefox 19+ */
            color:#cccccc;
        }
        input:-moz-placeholder{    /* Mozilla Firefox 4 to 18 */
            color:#cccccc;
        }
        input:-ms-input-placeholder{  /* Internet Explorer 10-11 */ 
            color:#cccccc;
        }
</style>
{/block}
{block name="body"}
<div class="cont" style="padding:50px 0 0 0;"> 
<div style="width:98%; margin:auto;">
	<form class="form" id="form_2" name="form1" action="" style="display:block;" enctype="application/x-www-form-urlencoded" method="post">
	<div id="passwordclass" style=" width:100%; height:50px; line-height:50px; margin-top:10px; margin-bottom:10px; padding-left:5px;border-bottom: 1px solid #ccc;">
	<div style="float:left; width:27%; text-align:center"><span style="color: #666;">密码类型：</span></div>
	<span style="margin-left: 12px;color: #666;">登录密码</span><input type="radio" name="passwordclass" value="1" style="width:10%; height:15px; padding-left:5px"  checked>
	<span style="margin-left: 12px;color: #666;">提款密码</span><input type="radio" name="passwordclass" value="2" style="width:10%; height:15px; padding-left:5px">
	
	</div>
	<div style="width:100%; height:50px; line-height:50px; margin-top:10px; margin-bottom:10px; padding-left:5px;border-bottom: 1px solid #ccc;">
	<div style="float:left; width:25%; text-align:center"><span style="color: #666;">原始密码：</span></div>
	<input name="old_password" type="password" id="old_password" placeholder="请输入旧密码" maxlength="20" style="width:70%; height:35px; padding-left:5px;margin-top:1.5%;">
	</div>
	
	<div style=" width:100%; height:50px; line-height:50px; margin-top:10px; margin-bottom:10px;padding-left:5px;border-bottom: 1px solid #ccc;">
	<div style="float:left; width:25%; text-align:center"><span style="color: #666;">新的密码：</span></div>
	<input name="new_password" type="password" id="new_password" placeholder="请输入新密码" maxlength="20" style="width:70%; height:35px; padding-left:5px;margin-top:1.5%;">
	</div>
	
	
	<div style=" width:100%; height:50px; line-height:50px; margin-top:10px; margin-bottom:10px; padding-left:5px;border-bottom: 1px solid #ccc;">
	<div style="float:left; width:28%; text-align:center"><span style="color: #666;">确认新密码：</span></div>
	<input name="new_password2" type="password" id="new_password2" placeholder="请输入新密码" maxlength="20" style="width:70%; height:35px; padding-left:5px;margin-top:1.5%;">
	</div>
	
	
	
	<div style="width: 100%;height: 50px;line-height: 50px;margin-top: 10px;margin-bottom: 10px;border: #CCCCCC solid 1px;background: #e53120;padding-left: 5px;border-radius: 10px;">

		<span  class="btn" id="sub" style="display:inline-block;width: 25%;height: 48px;text-align: center;background: #e53120;margin-left: 35%;font-size: 22px;color: white;">确定</span>

		</div>
</form>
</div>
 
 </div>
 <script>

 $("#sub").click(function(){
	 var oldpass = document.getElementById("old_password").value;
	 var newpass = document.getElementById("new_password").value;
	 var newpass2 = document.getElementById("new_password2").value;
	 var type = $("#passwordclass input[type=radio]:checked").val();

	 if(oldpass == ''){
		 alert('旧密码不能为空');
		 return false;
	 }else if(newpass == ''){
		 alert('新密码不能为空');
		 return false;
	 }else if(newpass2 == ''){
		 alert('请再次输入新密码');
		 return false;
	 }else if(newpass != newpass2){
		 alert('两次密码不一致！');
		 return false;
	 }

	$.ajax({
		type:"post",
		url:"/mobile/member/passxgmm",
		data:{"old_password":oldpass,"new_password":newpass,"new_password2":newpass2,"passwordclass":type},
		dataType:"json",
		success: function (data){
			if(data.code == 1){
				alert(data.msg);
				window.location.href = "{:url('member/index')}";
			}else{
				alert(data.msg);
				return false;
			}
		},
		error:function(msg){
			alert('错误');
		}
	});
 });
 </script>
 

 
 {/block}
